﻿package Cain.MkMc 
{
	import fl.controls.Button;
	import flash.display.BlendMode;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import com.greensock.TweenLite;
	/**
	 * 確定按鈕對話框 v1.0
	 * @author Cain
	 */
	public class CoBk_OkBn extends CoBk {
		/**
		 * 確定按鈕
		 */
		public var bn           :Button;
		/**
		 * 建構
		 * @param	_str 顯示訊息
		 * @param	_bn 按鈕上的文字
		 */
		public function CoBk_OkBn(_str:String = "", _bn:String = "確定") 
		{
			bn = new Button();
			bn.label = _bn;
			super(_str);
			
		}
		/**
		 * 建構元件與底圖
		 * @private
		 */
		override protected function sp_setup():void
		{
			sp = new Sprite();
			var tf_ww:Number = textFild.width;
			var tf_hh:Number = textFild.height;
			sp.graphics.beginFill(0xFFFFFF);
			if (tf_ww<bn.width) 
			{
				sp.graphics.drawRoundRect(0, 0, bn.width + D * 2, tf_hh + D * 2 + bn.height, R, R);
			}else 
			{
				sp.graphics.drawRoundRect(0, 0, tf_ww + D * 2, tf_hh + D * 2  + bn.height, R, R);
			}
			sp.graphics.endFill();
			if (tf_ww<bn.width) 
			{
				textFild.x = (sp.width >> 1) - (tf_ww >> 1); 
			}else 
			{
				textFild.x = D;
			}
			textFild.y = D;
			sp.addChild(textFild);
			bn.x = (sp.width >> 1) - (bn.width >> 1);
			bn.y = D + tf_hh + 5;
			sp.addChild(bn);
			sp.x = -sp.width>>1;
			sp.y = -sp.height>>1;
			addChild(sp);
		}
	}
	
}